//
//  BaseTableViewController.swift
//  Sina(微博)
//
//  Created by mac on 15/12/12.
//  Copyright © 2015年 mac. All rights reserved.
//

import UIKit


class BaseTableViewController: UITableViewController,VisitorLoginViewDelegate {
    var userLogin = false
    var visitorLoginView: VisitorLoginView?
    
    override func loadView() {
        if userLogin {
        super.loadView()
        }else{
           setVisitorLoginView()
        
        }
    }
    private func setVisitorLoginView() {
        visitorLoginView = VisitorLoginView()
        //设置代理
        visitorLoginView?.visitroViewDelegate = self
        view = visitorLoginView
        self.navigationItem.leftBarButtonItem = UIBarButtonItem(title: "登陆", style: .Plain, target: self, action: "userWillLogin")
        
        self.navigationItem.rightBarButtonItem = UIBarButtonItem(title: "注册", style: .Plain, target: self, action: "userWillRegister")
         }
    override func viewDidLoad() {
        super.viewDidLoad()
        
    }
    
    func userWillLogin() {
        let oauth = OAuthViewController()
        let nav = UINavigationController(rootViewController: oauth)
        presentViewController(nav, animated: true, completion: nil)
        
        
    }
    
    func userWillRegister() {
        print("正在注册")
    }


}
